<template>
	<view class="content">
		<Loading class="loading" v-show="!isLoading" :isStatus='loadStatus'></Loading>
		<StatusBar></StatusBar>
	</view>
</template>

<script>
	export default {
		name: "notice",
		data() {
			return {
				title: "比分",
				page: null,
				isLoading: false, //是否加载完成显示
				loadStatus: 'load',
			}
		},
		onHide() {
			this.page.hide();

		},
		onShow() {
			console.log("show webview");

			this.create();
		},

		methods: {
			create() {
				let create = () => {

					this.getInfo().then((e) => {
						this.page = plus.webview.create("https://live.m.500.com/home/zq/sfc/cur", "bifen", {
							top: e.CustomBar + 'px',
							bottom: 50 + 'px'
						}, {
							preload: 'success'
						});
						this.page.addEventListener('loaded', (e)=> {
							console.log('Loaded: ' + this.page.getURL());
							this.page.evalJS(
								`var style = document.createElement('style');style.innerHTML='.follow, .item-tab,.sdk-show, .search-league, .icon-return, .sk-point, .sk-btips,.popup-newuser,#globalTabBar,#banner-3rd,.navigator ul li:nth-last-of-type(1),.app500-download ,.switch-box{ display: none!important;}'; document.getElementsByTagName('HEAD').item(0).appendChild(style)`
								);
								setTimeout(()=>{
									this.show();
								},500);
						}, false);

					})
				}
				(this.page!=null)?this.show():create();
			},

			show() {
				
				this.page.show("bifen","fade-in",()=>{
					
				});
				this.isLoading = true;
			}
		}

	}
</script>
